Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Winsock definition for errno values rather than the POSIX ones #13

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

cgutman
Copy link

@cgutman cgutman commented Sep 28, 2019

Modern Windows 10 SDKs have POSIX-compatible errno definitions in errno.h. These definitions match POSIX values, but Winsock uses different values. As a result, libnatpmp doesn't properly recognize WSAEWOULDBLOCK or WSAECONNREFUSED errors when built against the Windows 10 SDK. This prevents the NAT-PMP request retry logic from working properly.

@miniupnp miniupnp merged commit cad5c36 into miniupnp:master Sep 24, 2020
fanquake added a commit to fanquake/bitcoin that referenced this pull request Feb 17, 2021
The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds:
```bash
Extracting libnatpmp...
/home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
Preprocessing libnatpmp...
Configuring libnatpmp...
Building libnatpmp...
make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
natpmp.c:42: warning: "EWOULDBLOCK" redefined
   42 | #define EWOULDBLOCK WSAEWOULDBLOCK
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
  166 | #define EWOULDBLOCK 140
      |
natpmp.c:43: warning: "ECONNREFUSED" redefined
   43 | #define ECONNREFUSED WSAECONNREFUSED
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
  110 | #define ECONNREFUSED 107
      |
natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
ar crs libnatpmp.a natpmp.o getgateway.o
make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
Staging libnatpmp...
Postprocessing libnatpmp...
Caching libnatpmp...
```
fanquake added a commit to fanquake/bitcoin that referenced this pull request Feb 17, 2021
The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds:
```bash
Extracting libnatpmp...
/home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
Preprocessing libnatpmp...
Configuring libnatpmp...
Building libnatpmp...
make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
natpmp.c:42: warning: "EWOULDBLOCK" redefined
   42 | #define EWOULDBLOCK WSAEWOULDBLOCK
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
  166 | #define EWOULDBLOCK 140
      |
natpmp.c:43: warning: "ECONNREFUSED" redefined
   43 | #define ECONNREFUSED WSAECONNREFUSED
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
  110 | #define ECONNREFUSED 107
      |
natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
ar crs libnatpmp.a natpmp.o getgateway.o
make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
Staging libnatpmp...
Postprocessing libnatpmp...
Caching libnatpmp...
```
fanquake added a commit to fanquake/bitcoin that referenced this pull request Mar 3, 2021
The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds:
```bash
Extracting libnatpmp...
/home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
Preprocessing libnatpmp...
Configuring libnatpmp...
Building libnatpmp...
make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
natpmp.c:42: warning: "EWOULDBLOCK" redefined
   42 | #define EWOULDBLOCK WSAEWOULDBLOCK
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
  166 | #define EWOULDBLOCK 140
      |
natpmp.c:43: warning: "ECONNREFUSED" redefined
   43 | #define ECONNREFUSED WSAECONNREFUSED
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
  110 | #define ECONNREFUSED 107
      |
natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
ar crs libnatpmp.a natpmp.o getgateway.o
make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
Staging libnatpmp...
Postprocessing libnatpmp...
Caching libnatpmp...
```
fanquake added a commit to fanquake/bitcoin that referenced this pull request Mar 4, 2021
The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds:
```bash
Extracting libnatpmp...
/home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
Preprocessing libnatpmp...
Configuring libnatpmp...
Building libnatpmp...
make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
natpmp.c:42: warning: "EWOULDBLOCK" redefined
   42 | #define EWOULDBLOCK WSAEWOULDBLOCK
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
  166 | #define EWOULDBLOCK 140
      |
natpmp.c:43: warning: "ECONNREFUSED" redefined
   43 | #define ECONNREFUSED WSAECONNREFUSED
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
  110 | #define ECONNREFUSED 107
      |
natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
ar crs libnatpmp.a natpmp.o getgateway.o
make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
Staging libnatpmp...
Postprocessing libnatpmp...
Caching libnatpmp...
```
fanquake added a commit to bitcoin-core/gui that referenced this pull request Mar 6, 2021
7af2502 build: compile libnatpmp with -DNATPMP_STATICLIB on Windows (fanquake)
ee35745 build: use newer source for libnatpmp (fanquake)

Pull request description:

  The source we are currently using is from 2015. The upstream repo has
  received a small number of bug fixes and improvements since then.
  Including one that fixes an issue for Windows users:  miniupnp/libnatpmp#13.

  The source we are currently using is the most recent "official" release,
  however I don't think it's worth waiting for a new one. The maintainer
  was prompted to do so in Oct 2020, then again in Jan of this year, and
  no release has eventuated. Given libnatpmp is a new inclusion into our
  repository, I think we should be using this newer source.

  This also cleans up a few warnings we currently see in Windows depends builds:
  ```bash
  Extracting libnatpmp...
  /home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
  Preprocessing libnatpmp...
  Configuring libnatpmp...
  Building libnatpmp...
  make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
  x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
  x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
  natpmp.c:42: warning: "EWOULDBLOCK" redefined
     42 | #define EWOULDBLOCK WSAEWOULDBLOCK
        |
  In file included from natpmp.c:38:
  /usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
    166 | #define EWOULDBLOCK 140
        |
  natpmp.c:43: warning: "ECONNREFUSED" redefined
     43 | #define ECONNREFUSED WSAECONNREFUSED
        |
  In file included from natpmp.c:38:
  /usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
    110 | #define ECONNREFUSED 107
        |
  natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
    271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~
  ar crs libnatpmp.a natpmp.o getgateway.o
  make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
  Staging libnatpmp...
  Postprocessing libnatpmp...
  Caching libnatpmp...
  ```

ACKs for top commit:
  hebasto:
    ACK 7af2502

Tree-SHA512: 6939014ea986149a5bfdd42b516d563a65ae643516e234579d3f28e7c2f877b0270cc4305ae7c7cb131d6d946a6e0aedc84b4cc880a412612a878a333398b9d7
jonatack pushed a commit to jonatack/bitcoin that referenced this pull request Mar 6, 2021
The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds:
```bash
Extracting libnatpmp...
/home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
Preprocessing libnatpmp...
Configuring libnatpmp...
Building libnatpmp...
make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
natpmp.c:42: warning: "EWOULDBLOCK" redefined
   42 | #define EWOULDBLOCK WSAEWOULDBLOCK
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
  166 | #define EWOULDBLOCK 140
      |
natpmp.c:43: warning: "ECONNREFUSED" redefined
   43 | #define ECONNREFUSED WSAECONNREFUSED
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
  110 | #define ECONNREFUSED 107
      |
natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
ar crs libnatpmp.a natpmp.o getgateway.o
make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
Staging libnatpmp...
Postprocessing libnatpmp...
Caching libnatpmp...
```
Repository owner deleted a comment May 30, 2021
Fuzzbawls pushed a commit to Fuzzbawls/PIVX that referenced this pull request Jun 16, 2021
The source we are currently using is from 2015. The upstream repo has
received a small number of bug fixes and improvements since then.
Including one that fixes an issue for Windows users:
miniupnp/libnatpmp#13.

The source we are currently using is the most recent "official" release,
however I don't think it's worth waiting for a new one. The maintainer
was prompted to do so in Oct 2020, then again in Jan of this year, and
no release has eventuated. Given libnatpmp is a new inclusion into our
repository, I think we should be using this newer source.

This also cleans up a few warnings we currently see in depends builds:
```bash
Extracting libnatpmp...
/home/ubuntu/bitcoin/depends/sources/libnatpmp-20150609.tar.gz: OK
Preprocessing libnatpmp...
Configuring libnatpmp...
Building libnatpmp...
make[1]: Entering directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o natpmp.o natpmp.c
x86_64-w64-mingw32-gcc -Os -fPIC -Wall -DENABLE_STRNATPMPERR   -c -o getgateway.o getgateway.c
natpmp.c:42: warning: "EWOULDBLOCK" redefined
   42 | #define EWOULDBLOCK WSAEWOULDBLOCK
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:166: note: this is the location of the previous definition
  166 | #define EWOULDBLOCK 140
      |
natpmp.c:43: warning: "ECONNREFUSED" redefined
   43 | #define ECONNREFUSED WSAECONNREFUSED
      |
In file included from natpmp.c:38:
/usr/share/mingw-w64/include/errno.h:110: note: this is the location of the previous definition
  110 | #define ECONNREFUSED 107
      |
natpmp.c:271:5: warning: ‘readnatpmpresponseorretry’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  271 | int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
ar crs libnatpmp.a natpmp.o getgateway.o
make[1]: Leaving directory '/home/ubuntu/bitcoin/depends/work/build/x86_64-w64-mingw32/libnatpmp/20150609-13efa1beb87'
Staging libnatpmp...
Postprocessing libnatpmp...
Caching libnatpmp...
```
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 29, 2022
Summary:
bitcoin/bitcoin@a8d9f27 (main commit)
> net: Add libnatpmp support

bitcoin/bitcoin@ae749d1
> doc: Add libnatpmp stuff

Note: I excluded the changes in tor.md, as the documentation added in that file is not yet applicable until core#18077 is fully backported. I suggest we should backport this tohether with the release notes.

---
[[bitcoin/bitcoin#21320 | core#21320]]:
> build: fix libnatpmp macos cross compile
>
> Currently, our cross-compile of libnatpmp for macOS doesn't work at all.
> The wrong archiver is used, which produces an archive the linker doesn't like.
>
> Fix this by using the right `ar` (we do the same for upnp).
>
> While we're at it, we fixe the build so that we are using our c/ppflags.
> This  means building with `-O2` rather than `-Os`.

----

[[bitcoin/bitcoin#21209 | core#21209]]:
> build: compile libnatpmp with -DNATPMP_STATICLIB on Windows
>
> This fixes linking issues and mirrors what we do with miniupnpc.

> build: use newer source for libnatpmp
>
> The source we are currently using is from 2015. The upstream repo has
> received a small number of bug fixes and improvements since then.
> Including one that fixes an issue for Windows users:
> miniupnp/libnatpmp#13.
>
> The source we are currently using is the most recent "official" release,
> however I don't think it's worth waiting for a new one. The maintainer
> was prompted to do so in Oct 2020, then again in Jan of this year, and
> no release has eventuated. Given libnatpmp is a new inclusion into our
> repository, I think we should be using this newer source.
>
> This also cleans up a few warnings we currently see in depends builds

----

[[bitcoin/bitcoin#25917 | core#25917]]:
> depends: libnatpmp 07004b97cf691774efebe70404cf22201e4d330d
>
> This pulls in two changes I've upstreamed:
> Support for pkg-config: miniupnp/libnatpmp#19
> Suppressing a deprecation warning: miniupnp/libnatpmp#28

----

This is a backport of [[bitcoin/bitcoin#18077 | core#18077]] [7 & 12/13], [[bitcoin/bitcoin#21320 | core#21320]], [[bitcoin/bitcoin#21209 | core#21209]] and [[bitcoin/bitcoin#25917 | core#25917]]

Depends on D12094

Test Plan:
```
cmake .. -GNinja
ninja
```

`@bot build-win64 build-osx`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12075
deadalnix pushed a commit to Bitcoin-ABC/secp256k1 that referenced this pull request Sep 30, 2022
Summary:
bitcoin/bitcoin@a8d9f27 (main commit)
> net: Add libnatpmp support

bitcoin/bitcoin@ae749d1
> doc: Add libnatpmp stuff

Note: I excluded the changes in tor.md, as the documentation added in that file is not yet applicable until core#18077 is fully backported. I suggest we should backport this tohether with the release notes.

---
[[bitcoin/bitcoin#21320 | core#21320]]:
> build: fix libnatpmp macos cross compile
>
> Currently, our cross-compile of libnatpmp for macOS doesn't work at all.
> The wrong archiver is used, which produces an archive the linker doesn't like.
>
> Fix this by using the right `ar` (we do the same for upnp).
>
> While we're at it, we fixe the build so that we are using our c/ppflags.
> This  means building with `-O2` rather than `-Os`.

----

[[bitcoin/bitcoin#21209 | core#21209]]:
> build: compile libnatpmp with -DNATPMP_STATICLIB on Windows
>
> This fixes linking issues and mirrors what we do with miniupnpc.

> build: use newer source for libnatpmp
>
> The source we are currently using is from 2015. The upstream repo has
> received a small number of bug fixes and improvements since then.
> Including one that fixes an issue for Windows users:
> miniupnp/libnatpmp#13.
>
> The source we are currently using is the most recent "official" release,
> however I don't think it's worth waiting for a new one. The maintainer
> was prompted to do so in Oct 2020, then again in Jan of this year, and
> no release has eventuated. Given libnatpmp is a new inclusion into our
> repository, I think we should be using this newer source.
>
> This also cleans up a few warnings we currently see in depends builds

----

[[bitcoin/bitcoin#25917 | core#25917]]:
> depends: libnatpmp 07004b97cf691774efebe70404cf22201e4d330d
>
> This pulls in two changes I've upstreamed:
> Support for pkg-config: miniupnp/libnatpmp#19
> Suppressing a deprecation warning: miniupnp/libnatpmp#28

----

This is a backport of [[bitcoin/bitcoin#18077 | core#18077]] [7 & 12/13], [[bitcoin/bitcoin#21320 | core#21320]], [[bitcoin/bitcoin#21209 | core#21209]] and [[bitcoin/bitcoin#25917 | core#25917]]

Depends on D12094

Test Plan:
```
cmake .. -GNinja
ninja
```

`@bot build-win64 build-osx`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12075
melroy89 pushed a commit to BitcoinCash1/Bitcoin-Cash-Node that referenced this pull request Oct 10, 2024
Co-authored-by: Calin Culianu <calin.culianu@gmail.com>

Taken from ABC: https://reviews.bitcoinabc.org/D12075
Depends on !1836

Summary
---

bitcoin/bitcoin@a8d9f27 (main commit)
> net: Add libnatpmp support

bitcoin/bitcoin@ae749d1
> doc: Add libnatpmp stuff

Note: I excluded the changes in tor.md, as the documentation added
in that file is not yet applicable until core#18077 is fully backported.
I suggest we should backport this tohether with the release notes.

---

[[bitcoin/bitcoin#21320 | core#21320]]:
> build: fix libnatpmp macos cross compile
>
> Currently, our cross-compile of libnatpmp for macOS doesn't work at all.
> The wrong archiver is used, which produces an archive the linker doesn't like.
>
> Fix this by using the right `ar` (we do the same for upnp).
>
> While we're at it, we fixe the build so that we are using our c/ppflags.
> This  means building with `-O2` rather than `-Os`.

----

[[bitcoin/bitcoin#21209 | core#21209]]:
> build: compile libnatpmp with -DNATPMP_STATICLIB on Windows
>
> This fixes linking issues and mirrors what we do with miniupnpc.

> build: use newer source for libnatpmp
>
> The source we are currently using is from 2015. The upstream repo has
> received a small number of bug fixes and improvements since then.
> Including one that fixes an issue for Windows users:
> miniupnp/libnatpmp#13.
>
> The source we are currently using is the most recent "official" release,
> however I don't think it's worth waiting for a new one. The maintainer
> was prompted to do so in Oct 2020, then again in Jan of this year, and
> no release has eventuated. Given libnatpmp is a new inclusion into our
> repository, I think we should be using this newer source.
>
> This also cleans up a few warnings we currently see in depends builds

----

[[bitcoin/bitcoin#25917 | core#25917]]:
> depends: libnatpmp 07004b97cf691774efebe70404cf22201e4d330d
>
> This pulls in two changes I've upstreamed:
> Support for pkg-config: miniupnp/libnatpmp#19
> Suppressing a deprecation warning: miniupnp/libnatpmp#28

----

This is a backport of [[bitcoin/bitcoin#18077 | core#18077]] [7 & 12/13], [[bitcoin/bitcoin#21320 | core#21320]], [[bitcoin/bitcoin#21209 | core#21209]] and [[bitcoin/bitcoin#25917 | core#25917]]

Test Plan
---

- `cmake .. -GNinja ninja all check-all`
- Do a gitian and/or depends build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants